package com.sylli.oeuf.server.game.logic.action;

import com.sylli.oeuf.server.game.logic.ActionProduct;
import com.sylli.oeuf.server.game.logic.BattleActor;

public class CombatLog extends ActionProduct {

	private String formatter;
	
	private ActionProduct[] prods;
	
	public CombatLog(BattleActor source, BattleActor target, String formatter, ActionProduct ... prods) {
		super(source, target);
		this.formatter = formatter;
		this.prods = prods;
	}
	
	public void set(String formatter, ActionProduct ... prods) {
		this.formatter = formatter;
		this.prods = prods;
	}
	
	public String get() {
		String s = new String(formatter);
		int i=0;
		if (s.indexOf("%p") > 0) {
			s = s.replaceFirst("%p", prods[i].toString());
			i++;
		}
		return s;
	}

}
